package com.repair.payment.facade;

import com.repair.api.pay.request.PayQueryPageRequest;
import com.repair.api.pay.request.PayQueryRequest;
import com.repair.api.pay.request.PayRefundRequest;
import com.repair.api.pay.request.PaymentAddRequest;
import com.repair.api.pay.request.param.PayQueryParam;
import com.repair.api.pay.request.param.PaymentAddParam;
import com.repair.api.pay.response.PayAddResponse;
import com.repair.api.pay.response.PayQueryResponse;
import com.repair.api.pay.response.PayRefundResponse;
import com.repair.api.pay.response.vo.PaymentInfoVO;
import com.repair.api.pay.service.PaymentFacadeService;
import com.repair.base.response.PageResponse;
import com.repair.payment.service.PaymentRefundService;
import com.repair.payment.service.PaymentService;
import com.repair.rpc.config.Facade;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author chunyu
 * @since 2024/10/16,19:29
 */
@DubboService
public class PaymentFacadeServiceImpl implements PaymentFacadeService {

    @Autowired
    private PaymentService paymentService;

    @Autowired
    private PaymentRefundService paymentRefundService;

    @Override
    @Facade
    public PayAddResponse<PaymentInfoVO> addPayment(PaymentAddRequest<PaymentAddParam> payRequest) {
        return paymentService.addPayment(payRequest);
    }

    @Override
    @Facade
    public PayRefundResponse<Boolean> refund(PayRefundRequest payRefundRequest) {
        return paymentRefundService.refund(payRefundRequest);
    }

    @Override
    @Facade
    public PageResponse<PaymentInfoVO> getPaymentInfoList(PayQueryPageRequest<PayQueryParam> request) {
        return paymentService.getPaymentInfoList(request);
    }

    @Override
    @Facade
    public PayQueryResponse<PaymentInfoVO> getPaymentDetail(PayQueryRequest request) {
        return paymentService.getPaymentDetail(request);
    }


}
